home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1999 April / Cd Pc Users extra 19 abril 1999.iso / Prog / Inst / addin / Propset.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-10-27  |  7.5 KB  |  243 lines

  1. VERSION 4.00
  2. Begin VB.Form SetterDialog 
  3.    Caption         =   "Property Setter"
  4.    ClientHeight    =   3975
  5.    ClientLeft      =   2145
  6.    ClientTop       =   1740
  7.    ClientWidth     =   3990
  8.    Height          =   4665
  9.    Left            =   2085
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3975
  12.    ScaleWidth      =   3990
  13.    Top             =   1110
  14.    Width           =   4110
  15.    Begin VB.CommandButton CmdSetValues 
  16.       Caption         =   "Set Values"
  17.       Height          =   495
  18.       Left            =   1440
  19.       TabIndex        =   3
  20.       TabStop         =   0   'False
  21.       Top             =   3360
  22.       Width           =   1095
  23.    End
  24.    Begin VB.CommandButton CmdClose 
  25.       Cancel          =   -1  'True
  26.       Caption         =   "Close"
  27.       Height          =   495
  28.       Left            =   2760
  29.       TabIndex        =   4
  30.       TabStop         =   0   'False
  31.       Top             =   3360
  32.       Width           =   1095
  33.    End
  34.    Begin VB.CommandButton CmdGetValues 
  35.       Caption         =   "Get Values"
  36.       Default         =   -1  'True
  37.       Height          =   495
  38.       Left            =   120
  39.       TabIndex        =   2
  40.       TabStop         =   0   'False
  41.       Top             =   3360
  42.       Width           =   1095
  43.    End
  44.    Begin VB.TextBox ValuesText 
  45.       BeginProperty Font 
  46.          name            =   "Courier New"
  47.          charset         =   0
  48.          weight          =   400
  49.          size            =   8.25
  50.          underline       =   0   'False
  51.          italic          =   0   'False
  52.          strikethrough   =   0   'False
  53.       EndProperty
  54.       Height          =   2175
  55.       Left            =   120
  56.       Locked          =   -1  'True
  57.       MultiLine       =   -1  'True
  58.       ScrollBars      =   3  'Both
  59.       TabIndex        =   8
  60.       TabStop         =   0   'False
  61.       Top             =   1080
  62.       Width           =   3735
  63.    End
  64.    Begin VB.TextBox ValueText 
  65.       Height          =   285
  66.       Left            =   960
  67.       TabIndex        =   1
  68.       Top             =   480
  69.       Width           =   2895
  70.    End
  71.    Begin VB.TextBox PropertyText 
  72.       Height          =   285
  73.       Left            =   960
  74.       TabIndex        =   0
  75.       Top             =   120
  76.       Width           =   2895
  77.    End
  78.    Begin VB.Label Label1 
  79.       Caption         =   "Current Values:"
  80.       Height          =   255
  81.       Index           =   2
  82.       Left            =   120
  83.       TabIndex        =   7
  84.       Top             =   840
  85.       Width           =   1215
  86.    End
  87.    Begin VB.Label Label1 
  88.       Caption         =   "New Value:"
  89.       Height          =   255
  90.       Index           =   1
  91.       Left            =   120
  92.       TabIndex        =   6
  93.       Top             =   480
  94.       Width           =   855
  95.    End
  96.    Begin VB.Label Label1 
  97.       Caption         =   "Property:"
  98.       Height          =   255
  99.       Index           =   0
  100.       Left            =   120
  101.       TabIndex        =   5
  102.       Top             =   120
  103.       Width           =   855
  104.    End
  105.    Begin VB.Menu mnuFile 
  106.       Caption         =   "&File"
  107.       Begin VB.Menu mnuFileClose 
  108.          Caption         =   "&Close"
  109.          Shortcut        =   ^C
  110.       End
  111.    End
  112.    Begin VB.Menu mnuProp 
  113.       Caption         =   "&Properties"
  114.       Begin VB.Menu mnuPropSet 
  115.          Caption         =   "&Set Values"
  116.          Shortcut        =   ^S
  117.       End
  118.       Begin VB.Menu mnuPropGet 
  119.          Caption         =   "&Get Values"
  120.          Shortcut        =   ^G
  121.       End
  122.    End
  123.    Begin VB.Menu mnuHelp 
  124.       Caption         =   "&Help"
  125.       Begin VB.Menu mnuHelpAbout 
  126.          Caption         =   "&About Property Setter"
  127.       End
  128.    End
  129. Attribute VB_Name = "SetterDialog"
  130. Attribute VB_Creatable = False
  131. Attribute VB_Exposed = False
  132. ' ************************************************
  133. ' The user uses this dialog to specify properties
  134. ' and the values they should have. When the user
  135. ' presses the Apply button, the form invokes the
  136. ' PropSet object's Apply subroutine to set the
  137. ' property values.
  138. ' ************************************************
  139. Option Explicit
  140. ' The PropSet object.
  141. Public prop_setter As PropSet
  142. ' ************************************************
  143. ' Get the indicated property values for the
  144. ' selected controls.
  145. ' ************************************************
  146. Private Sub CmdGetValues_Click()
  147. Dim prop_name As String
  148. Dim values As String
  149.     ' Get the property name.
  150.     prop_name = Trim$(PropertyText.Text)
  151.     If prop_name = "" Then
  152.         Beep
  153.         MsgBox "Please enter a property name.", _
  154.             vbOKOnly + vbInformation, _
  155.             "Blank Property Name"
  156.         Exit Sub
  157.     End If
  158.     ' List the property values.
  159.     values = prop_setter.GetValues(prop_name)
  160.     ValuesText.Text = values
  161. End Sub
  162. ' ************************************************
  163. ' Invoke the PropSet object's Apply subroutine.
  164. ' ************************************************
  165. Private Sub CmdSetValues_Click()
  166. Dim prop_name As String
  167. Dim prop_value As String
  168. Dim values As String
  169.     ' Get the property name.
  170.     prop_name = Trim$(PropertyText.Text)
  171.     If prop_name = "" Then
  172.         Beep
  173.         MsgBox "Please enter a property name.", _
  174.             vbOKOnly + vbInformation, _
  175.             "Blank Property Name"
  176.         Exit Sub
  177.     End If
  178.     ' Get the property value. Note that a blank
  179.     ' value is valid.
  180.     prop_value = Trim$(ValueText.Text)
  181.     ' Set the property values and get the
  182.     ' updated list.
  183.     values = prop_setter.SetValues(prop_name, prop_value)
  184.     ValuesText.Text = values
  185. End Sub
  186. ' ************************************************
  187. ' Unload the dialog.
  188. ' ************************************************
  189. Private Sub CmdClose_Click()
  190.     Unload Me
  191. End Sub
  192. ' ************************************************
  193. ' Start with a list of names.
  194. ' ************************************************
  195. Private Sub Form_Load()
  196. Dim values As String
  197.     values = prop_setter.GetValues("")
  198.     ValuesText.Text = values
  199. End Sub
  200. ' ************************************************
  201. ' Make the value text area as large as possible.
  202. ' ************************************************
  203. Private Sub Form_Resize()
  204. Dim gap As Single
  205. Dim wid As Single
  206. Dim hgt As Single
  207.     gap = ValuesText.Left
  208.     wid = ScaleWidth - gap - PropertyText.Left
  209.     If wid < 480 Then wid = 480
  210.     PropertyText.Width = wid
  211.     ValueText.Width = wid
  212.     wid = ScaleWidth - 2 * gap
  213.     If wid < 480 Then wid = 480
  214.     ValuesText.Width = wid
  215.     hgt = ScaleHeight - ValuesText.Top - 2 * gap - CmdSetValues.Height
  216.     If hgt < 480 Then hgt = 480
  217.     ValuesText.Height = hgt
  218.     CmdSetValues.Top = ValuesText.Top + hgt + gap
  219.     CmdGetValues.Top = CmdSetValues.Top
  220.     CmdClose.Top = CmdSetValues.Top
  221. End Sub
  222. ' ************************************************
  223. ' Trigger CmdClose.
  224. ' ************************************************
  225. Private Sub mnuFileClose_Click()
  226.     CmdClose_Click
  227. End Sub
  228. Private Sub mnuHelpAbout_Click()
  229.     AboutDialog.Show vbModal
  230. End Sub
  231. ' ************************************************
  232. ' Trigger CmdGetValues.
  233. ' ************************************************
  234. Private Sub mnuPropGet_Click()
  235.     CmdGetValues_Click
  236. End Sub
  237. ' ************************************************
  238. ' Trigger CmdSetValues.
  239. ' ************************************************
  240. Private Sub mnuPropSet_Click()
  241.     CmdSetValues_Click
  242. End Sub
  243.